<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue中的路由初步</title>
    <style>
      .fade-enter{
         opacity: 0;
      }
      .fade-enter-active{
          transition: 3s all  ease;;
      }
      .fade-enter-to{
          opacity: 0.7;
          
      }
      .fade-leave-active{
          transition:1s all  ease;
      }
      .fade-leave-to{
          opacity: 0;
          transform:translateX(300px);
      }
    </style>
</head>
<body>
    <div id="app">
        <button @click="show=!show">切换</button>
        <transition name="fade">
            <div v-bind:style="styleObj" v-if="show"></div>
        </transition>
       
    </div>
    <script src="node_modules/vue/dist/vue.js"></script>
    <script>
      new Vue({
          el: "#app",
          data: {
              styleObj: {width:"100px", height:"100px", backgroundColor:"red",margin: "0 auto"},
              show:true
          }
          
      });
    </script>
</body>
</html>